.\" Copyright (C) 2010 Romain Tartiere
.\"
.\" This program is free software: you can redistribute it and/or modify it
.\" under the terms of the GNU Lesser General Public License as published by the
.\" Free Software Foundation, either version 3 of the License, or (at your
.\" option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful, but WITHOUT
.\" ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
.\" FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
.\" more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public License
.\" along with this program.  If not, see <http://www.gnu.org/licenses/>
.\"
.\" $Id$
.\"
.Dd July 20, 2010
.Dt MIFARE_DESFIRE_KEY 3
.Os
.\"  _   _
.\" | \ | | __ _ _ __ ___   ___
.\" |  \| |/ _` | '_ ` _ \ / _ \
.\" | |\  | (_| | | | | | |  __/
.\" |_| \_|\__,_|_| |_| |_|\___|
.\"
.Sh NAME
.Nm mifare_desfire_des_key_new ,
.Nm mifare_desfire_3des_key_new ,
.Nm mifare_desfire_3k3des_key_new ,
.Nm mifare_desfire_aes_key_new ,
.Nm mifare_desfire_des_key_new_with_version ,
.Nm mifare_desfire_3des_key_new_with_version ,
.Nm mifare_desfire_3k3des_key_new_with_version ,
.Nm mifare_desfire_aes_key_new _with_version,
.Nm mifare_desfire_key_get_version ,
.Nm mifare_desfire_key_set_version ,
.Nm mifare_desfire_key_free
.Nd Mifare DESFire keys Manipulation Functions
.\"  _     _ _
.\" | |   (_) |__  _ __ __ _ _ __ _   _
.\" | |   | | '_ \| '__/ _` | '__| | | |
.\" | |___| | |_) | | | (_| | |  | |_| |
.\" |_____|_|_.__/|_|  \__,_|_|   \__, |
.\"                               |___/
.Sh LIBRARY
Mifare card manipulation library (libfreefare, \-lfreefare)
.\"  ____                              _
.\" / ___| _   _ _ __   ___  _ __  ___(_)___
.\" \___ \| | | | '_ \ / _ \| '_ \/ __| / __|
.\"  ___) | |_| | | | | (_) | |_) \__ \ \__ \
.\" |____/ \__, |_| |_|\___/| .__/|___/_|___/
.\"        |___/            |_|
.Sh SYNOPSIS
.In freefare.h
.Ft MifareDESFireKey
.Fn mifare_desfire_des_key_new "uint8_t value[8]"
.Ft MifareDESFireKey
.Fn mifare_desfire_3des_key_new "uint8_t value[16]"
.Ft MifareDESFireKey
.Fn mifare_desfire_3k3des_key_new "uint8_t value[24]"
.Ft MifareDESFireKey
.Fn mifare_desfire_aes_key_new "uint8_t value[16]"
.Ft MifareDESFireKey
.Fn mifare_desfire_des_key_new_with_version "uint8_t value[8]"
.Ft MifareDESFireKey
.Fn mifare_desfire_3des_key_new_with_version "uint8_t value[16]"
.Ft MifareDESFireKey
.Fn mifare_desfire_3k3des_key_new_with_version "uint8_t value[24]"
.Ft MifareDESFireKey
.Fn mifare_desfire_aes_key_new_with_version "uint8_t value[16]" "uint8_t version"
.Ft uint8_t
.Fn mifare_desfire_key_get_version "MifareDESFireKey key"
.Ft void
.Fn mifare_desfire_key_set_version "MifareDESFireKey key" "uint8_t version"
.Ft void
.Fn mifare_desfire_key_free "MifareDESFireKey key"
.\"  ____                      _       _   _
.\" |  _ \  ___  ___  ___ _ __(_)_ __ | |_(_) ___  _ __
.\" | | | |/ _ \/ __|/ __| '__| | '_ \| __| |/ _ \| '_ \
.\" | |_| |  __/\__ \ (__| |  | | |_) | |_| | (_) | | | |
.\" |____/ \___||___/\___|_|  |_| .__/ \__|_|\___/|_| |_|
.\"                             |_|
.Sh DESCRIPTION
The
.Fn mifare_desfire_key_*
family of functions allows management of Mifare DESFire keys.
.Pp
The
.Fn mifare_desfire_des_key_new ,
.Fn mifare_desfire_3des_key_new ,
.Fn mifare_desfire_3k3des_key_new
and
.Fn mifare_desfire_ades_key_new
alocate a new key with the provided data
.Va value .
The key version is set to
.Va 0 .
.Pp
The
.Fn mifare_desfire_des_key_new_with_version ,
.Fn mifare_desfire_3des_key_new_with_version ,
.Fn mifare_desfire_3k3des_key_new_with_version
and
.Fn mifare_desfire_aes_key_new_with_version
functions are equivalent to the previous functions except that the key version
is read from
.Va value
(DES, 3DES, 3K3DES) or set to
.Va version
(AES).
.Pp
The version of a
.Vt MifareDESFireKey
can be extracted using
.Fn mifare_desfire_key_get_version
and changed using
.Fn mifare_desfire_key_set_version.
.Pp
The
.Fn mifare_desfire_key_free
has to be called for each
.Va MifareDESFireKey
after usage to reclaim memory.
.\"  ____      _                                 _
.\" |  _ \ ___| |_ _   _ _ __ _ __   __   ____ _| |_   _  ___  ___
.\" | |_) / _ \ __| | | | '__| '_ \  \ \ / / _` | | | | |/ _ \/ __|
.\" |  _ <  __/ |_| |_| | |  | | | |  \ V / (_| | | |_| |  __/\__ \
.\" |_| \_\___|\__|\__,_|_|  |_| |_|   \_/ \__,_|_|\__,_|\___||___/
.\"
.Sh RETURN VALUES
Key allocations functions return the allocaed key of
.Va NULL
on failure.
.\"  ____                    _
.\" / ___|  ___  ___    __ _| |___  ___
.\" \___ \ / _ \/ _ \  / _` | / __|/ _ \
.\"  ___) |  __/  __/ | (_| | \__ \ (_) |
.\" |____/ \___|\___|  \__,_|_|___/\___/
.\"
.Sh SEE ALSO
.Xr mifare_desfire 3
.\"     _         _   _
.\"    / \  _   _| |_| |__   ___  _ __ ___
.\"   / _ \| | | | __| '_ \ / _ \| '__/ __|
.\"  / ___ \ |_| | |_| | | | (_) | |  \__ \
.\" /_/   \_\__,_|\__|_| |_|\___/|_|  |___/
.\"
.Sh AUTHORS
.An Romain Tartiere Aq romain@il4p.org
